﻿
using System;
using System.Net;
namespace WebTranslator {
	public class RunTranslationServers {
		public static void StartServers(IPAddress master, int ile) {
			for (int i = 0; i < ile; ++i) {
				new TranslationServer(master, StartingApplicationPorts.MainServerToTranslationServers + i);
			}
		}
		public static void Main() {
			
			IPAddress masterAddress = GetMasterServerAddress();
			MasterServer.ChooseIpAddress();
			StartServers(masterAddress, StartingApplicationPorts.NumberOfTranslationServers);
		}

		private static IPAddress GetMasterServerAddress() {
			string line = "";
			IPAddress address;
			while (!IPAddress.TryParse(line, out address)) {
				Console.WriteLine("Podaj adres ip Master Serwera");
				line = Console.ReadLine();
			}
			return address;
		}
	}
}
